const common = {
  namespaced: true,
  state: {
    style: {
      list: [],
      info: {},
    }
  },
  mutations: {

  },
  actions: {
    GetList(context, param) {
      // 获取风采列表
      global.POST(global.api.GetList, {
        Page: param.deploy.Page,
        Rows: param.deploy.Rows,
        Type: param.deploy.Type,
      }).then(res => {
        if (param.clear)
          context.state.style.list = res._NewsList
        else
          context.state.style.list = context.state.style.list.concat(res._NewsList)
        if (param.ref != undefined) {
          if (res._NewsList.length < param.deploy.Rows) {
            param.ref.finishInfinite(true)
          } else {
            param.ref.finishPullToRefresh()
            if (param.pageAdd != undefined)
              param.pageAdd()
          }
        }
        if (param.success != undefined)
          param.success()
      })
    },
    GetInfo(context, param) {
      // 获取详情
      global.POST(global.api.GetInfo, {
        Id:param
      }).then(res => {
        context.state.style.info = res._News
      })
    }
  },
  getters: {}
}
export default common